<?php

namespace app\admin\controller\Article;

use app\admin\model\Recarticle as ModelAlcitle;
use app\common\controller\AdminController;
use app\admin\traits\Curd;
use think\App;
use think\facade\Db;
use think\facade\Request;

class Recarticle extends AdminController
{
    use Curd;

    protected $relationSearch = true; //开启关联查询

    public function __construct(App $app) //构造方法
    {
        parent::__construct($app);
        $this->model = new ModelAlcitle(); //当前模型== XyhCarouselImg 这张表
    }

    public function delete()
    {
        if (Request::isAjax()) {
            $id = Request::get('id');
            // dump($getdata);die;
            if (Db::name('recarticle')->delete($id)) {
                return json(['msg' => '删除成功' , 'code' => '01']);
            }
            return json(['msg' => '删除失败' , 'code' => '05']);
        }
    }


}
